package com.solcoo.controller;

import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.solcoo.pojo.PriceTicket;
import com.solcoo.service.PriceTicketService;

@Controller
public class PriceTicketController extends AbstractController{
	
	@Resource
    PriceTicketService priceTicketService;

    /**
     * 修改抵价券(在首次关注时，赠送抵价券金额,金额为0时不赠送,修改金额保存后生效,
     * 每个商户对应一个抵价券。可对商户id进行唯一性处理)
     */
    @RequestMapping(value="modifyPriceTicket.do")
    public @ResponseBody JsonResult modifyPriceTicket(PriceTicket pt) throws Exception {
        priceTicketService.modifyPriceTicket(pt);
        return this.getSuccessJsonResult("修改抵价券成功");
    }


    @RequestMapping(value="queryPriceTicket.do")
    public @ResponseBody JsonResult queryPriceTicket(int merchantId) throws Exception {
        PriceTicket pt = priceTicketService.queryPriceTicket(merchantId);
        return this.getSuccessJsonResult(pt);
    }
}
